/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package logica;

/**
 *
 * @author Meme
 */
public class ItemRatingRestaurant {
    private int total;
    private final java.util.ArrayList<ItemRating> ratings;
    
    public ItemRatingRestaurant() {
        total = 0;
        ratings = new java.util.ArrayList();
    }
    
    public java.util.ArrayList<ItemRating> getRatings(){
        return ratings;
    }
    
    public void addRating(ItemRating puntaje) {
        total += puntaje.getScore();
        ratings.add(0, puntaje);
    }
    
    public int getAverage() {
        int size = ratings.size();
        
        if (size == 0)
            return 0;
        
        return total/ratings.size();
    }
    
    public void addToTotal(int puntaje) {
        total += puntaje;
    }
}
